package tests;

import static org.junit.Assert.assertEquals;
import model.components.ComponentDoor;
import model.components.ComponentSensor;
import model.sensors.SensorDoor;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import utils.Constants;

public class ComponentSensorTest {

	protected ComponentDoor cd;
	protected ComponentSensor cs;

	@Before
	public void setUp() throws Exception {
		cd = new ComponentDoor("Door 1", Constants.COMPONENT_DOOR_CLOSED);
		cs = new SensorDoor("Sensor Door 1", 0, cd);
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetAndSetMode() {
		assertEquals((int) 0, cs.getMode());
		cs.setMode(1);
		assertEquals((int) 1, cs.getMode());
		cs.setMode(0);
		assertEquals((int) 0, cs.getMode());
	}

	@Test
	public void testLabel() {
		assertEquals((String) "Sensor Door 1", cs.getComponentLabel());
		cs.setComponentLabel("Sensor Door 1 test");
		assertEquals((String) "Sensor Door 1 test", cs.getComponentLabel());
		cs.setComponentLabel("Sensor Door 1");
		assertEquals((String) "Sensor Door 1", cs.getComponentLabel());
	}

}
